<?php
/*
 * config Gerrit:
 * 	include /usr/local/PEAR/PHPUnit to your php interpreter include path
 * 	--	cd /Users/Gerrit/Documents/Zaken/Yes2web/svn/Custom\ App\ Framework/current/test/caf
 * 	--	java -jar /usr/local/bin/selenium-server.jar -firefoxProfileTemplate /Users/Gerrit/Library/Application\ Support/Firefox/Profiles
 * 	--  /Applications/Firefox.app/Contents/MacOS/firefox-bin
 * 
 * --	phpdoc -t doc -d classes,doc/tutorials 
 * Usage:
 * -1)	testing:	phpunit AllTests.class.php
 * 0)	testing:	phpunit --verbose AllTests.class.php
 * 1)	testdox:	phpunit --testdox AllTests.class.php
 * 2)	clover:		phpunit --coverage-html ../report AllTests.class.php
 */
error_reporting(E_ALL);
date_default_timezone_set('Europe/Amsterdam');
require_once 'PHPUnit/Util/Filter.php';

$sPackageDir = dirname(__FILE__).'/../classes/event/';
require $sPackageDir.'event.class.php';

// prepare the settings for the coverage report
PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(
	dirname(__FILE__), '.php'
);
PHP_CodeCoverage_Filter::getInstance()->removeDirectoryFromBlacklist(
	$sPackageDir, '.php'
);

function test_event_autoload($sClassName){
	if (substr($sClassName, -3) == 'Set') $sClassName = substr($sClassName, 0, -3); 
	
	$sFileName = dirname(__FILE__).'/../'.str_replace('_', DIRECTORY_SEPARATOR, strtolower($sClassName)).'.class.php';
	if (is_file($sFileName)){
		require $sFileName;
	}
	return false;
}
spl_autoload_register('test_event_autoload');

class AllEventTests {
	public static function suite(){
		$oSuite = new PHPUnit_Framework_TestSuite('Event, event log');
		
		$oSuite->addTestSuite(new Test_Event_Suite());
		$oSuite->addTestSuite(new Test_Event_Log_Suite());
		
		return $oSuite;
	}
}
class Test_Event_Suite extends PHPUnit_Framework_TestSuite {
	public function __construct(){
		parent::__construct('event');
		
		$this->addTestSuite('Test_Event_Event');
		$this->addTestSuite('Test_Event_Handler');
		$this->addTestSuite('Test_Event_Exception');
	}
}
class Test_Event_Log_Suite extends PHPUnit_Framework_TestSuite {
	public function __construct(){
		parent::__construct('event log');
		
		$this->addTestSuite('Test_Event_Log_Handler');
		$this->addTestSuite('Test_Event_Log_Message');
	}
}